package com.dianning.web.action;

import java.util.Date;
import java.util.List;

import org.apache.commons.logging.*;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.dianning.bean.AdAds;
import com.dianning.bean.Company;
import com.dianning.bean.InfoExpand;
import com.dianning.bean.Money;
import com.dianning.bean.Profile;
import com.dianning.bean.Resume;
import com.dianning.bean.UserDetail;
import com.dianning.bean.UserInfo;
import com.dianning.bean.Visitor;
import com.dianning.comm.Util;
import com.dianning.exception.DianningException;
import com.dianning.service.AdService;
import com.dianning.service.InfoService;
import com.dianning.service.ProfileService;
import com.dianning.service.UserInfoService;
import com.dianning.service.VisitorService;
import com.dianning.web.interceptor.RemoteAddrAware;

public class Map extends BaseAction{

	private static final Log logger = LogFactory.getLog(Map.class);
	
	private InfoService infoService;
	private ProfileService profileService;
	
	public InfoService getInfoService() {
		return infoService;
	}

	public void setInfoService(InfoService infoService) {
		this.infoService = infoService;
	}

	public ProfileService getProfileService() {
		return profileService;
	}

	public void setProfileService(ProfileService profileService) {
		this.profileService = profileService;
	}
	
	private long id;
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	private String key = "";

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String execute() {
		try {
			return this.executeMethod(this.getAction());
		} catch (Exception e) {
			logger.error(e);
			return ERROR;
		}
	}

	public String index(){
		InfoExpand infoExpand = null;
		infoExpand = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "housing");
		if(infoExpand!=null){
			key = infoExpand.getSvalue();
		}
		infoExpand = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "address");
		if(infoExpand!=null){
			key = infoExpand.getSvalue();
		}
		return "big";
	}
	
	public String profile(){
		Profile p = this.getProfileService().findProfileByUid(this.id);
		key = p.getAddress();
		return "small";
	}

}
